Hi,
I'm currently working on a DXL attribute which lists the link information for my objects. I was wondering if there was anyway where I can set a trigger that will execute DXL code one the user double clicks on the DXL attribute.
Right now, I can't use the "modify" trigger, because DXL attributes are unmodifiable, so I'm kind of at a dead end. I'm pretty sure there isn't a way to do an "on-click" trigger, but does anyone have another way to approach this? Thanks!~
wcheng - Mon Nov 23 16:18:43 EST 2009 |
|
Re: On-Click Trigger Mathias Mamsch - Mon Nov 23 16:56:01 EST 2009
If I understand you right, you want to refresh your DXL attribute, when the user clicks on an object? The first question from me would be, why you don't use a DXL Layout instead of a DXL attribute (which will update 'on the fly') ?
There is a 'sync' trigger, which will run, when you change the currently selected object (does not work always, e.g. when you copy an object, the selection will change, but the trigger will not fire). In addition you need to know, that setting the value of a DXL Attribute to 'null' will cause the DXL attribute to recalculate. You can use this in combination with a sync trigger or a DXL Layout to update your DXL attribute values.
If you want to invoke a DXL script in an easy way, you can also add a command to the module editor popup menu. This way the user can right-click on an object and run a command. Another way would be a keyboard shortcut, that you assign using a menu item.
Hope this gives you some ideas,
Regards, Mathias
|
|
Re: On-Click Trigger llandale - Tue Nov 24 19:51:24 EST 2009
The module Tools menu has a pulldown to "Refresh DXL Attributes". So that's two clicks, but all the objects are updated.
As for the trigger, perhaps an object sync trigger. The user selects the DXL column. The user clicks an object firing the trigger. The trigger gets the attribute name of the getSelectedCol(mod) and if its a DXL attribute then it sets the (current Object).NameAttr to null, forcing it to recalculate.
|
|
Re: On-Click Trigger wcheng - Wed Nov 25 13:29:23 EST 2009 Mathias Mamsch - Mon Nov 23 16:56:01 EST 2009
If I understand you right, you want to refresh your DXL attribute, when the user clicks on an object? The first question from me would be, why you don't use a DXL Layout instead of a DXL attribute (which will update 'on the fly') ?
There is a 'sync' trigger, which will run, when you change the currently selected object (does not work always, e.g. when you copy an object, the selection will change, but the trigger will not fire). In addition you need to know, that setting the value of a DXL Attribute to 'null' will cause the DXL attribute to recalculate. You can use this in combination with a sync trigger or a DXL Layout to update your DXL attribute values.
If you want to invoke a DXL script in an easy way, you can also add a command to the module editor popup menu. This way the user can right-click on an object and run a command. Another way would be a keyboard shortcut, that you assign using a menu item.
Hope this gives you some ideas,
Regards, Mathias
Hi Mathias,
Thanks for the response
THe reason why I don't want to use a layout DXL is cause the attribute that I'm interested can let the user manually type in values. I know that DXL attributes are read-only, but why I wanted to use a trigger that is "on-click" is because when the user clicks on the field to modify an object, a window will pop-up prompting the user to see if he wants to add to the existing values. The user will just then ahve to type in the value, and it will append the value to the existing list.
From what I've seen from using the 'sync' trigger, it will not trigger for read-only attributes, therefore, I don't think it will be possible to implement what I originally wanted to do. I do have a question though. How can you create a keyboard shortcut in DOORs?? Also, how do you get it to show up when the user right-clicks the item? Thanks! I appreciate teh help
|
|
Re: On-Click Trigger ePiallat - Thu Nov 26 04:00:56 EST 2009 wcheng - Wed Nov 25 13:29:23 EST 2009
Hi Mathias,
Thanks for the response
THe reason why I don't want to use a layout DXL is cause the attribute that I'm interested can let the user manually type in values. I know that DXL attributes are read-only, but why I wanted to use a trigger that is "on-click" is because when the user clicks on the field to modify an object, a window will pop-up prompting the user to see if he wants to add to the existing values. The user will just then ahve to type in the value, and it will append the value to the existing list.
From what I've seen from using the 'sync' trigger, it will not trigger for read-only attributes, therefore, I don't think it will be possible to implement what I originally wanted to do. I do have a question though. How can you create a keyboard shortcut in DOORs?? Also, how do you get it to show up when the user right-clicks the item? Thanks! I appreciate teh help
Hi,
We consider implementing such a behavior back in DOORS 5, and at this time we found the trigger mechanism be too much instable.
We finally used this simple work-around:
For each attribute "my DXL Attr" that results from a calculation that could be edited, we created a separated regular attribute called "MI for my DXL Attr", for manual entry.
Then we modified the code from "my DXL Attr" in order to merge values from "MI for my DXL Attr" with actual result from calculation.
In other places, we add pseudo DXL-attributes that return always "-", but that in the mean time checked and corrected values from a set of regular, manual attributes.
Of course, this check was triggered by setting DXL-attribute to null THEN reading the "-" value, as we never displayed them.
|
|
Re: On-Click Trigger Mathias Mamsch - Thu Nov 26 04:11:11 EST 2009 wcheng - Wed Nov 25 13:29:23 EST 2009
Hi Mathias,
Thanks for the response
THe reason why I don't want to use a layout DXL is cause the attribute that I'm interested can let the user manually type in values. I know that DXL attributes are read-only, but why I wanted to use a trigger that is "on-click" is because when the user clicks on the field to modify an object, a window will pop-up prompting the user to see if he wants to add to the existing values. The user will just then ahve to type in the value, and it will append the value to the existing list.
From what I've seen from using the 'sync' trigger, it will not trigger for read-only attributes, therefore, I don't think it will be possible to implement what I originally wanted to do. I do have a question though. How can you create a keyboard shortcut in DOORs?? Also, how do you get it to show up when the user right-clicks the item? Thanks! I appreciate teh help
The sync trigger will fire if the current object changes (but not 100% reliably!), it is not dependent on read only attributes. This means, when you click on an object (no matter on which column you click) in the module editor or use the cursor to navigate between the objects, then the trigger will fire.
The right click thing is quite straight forward. Just put a dxl file in you lib/dxl/config/formalPopup directory, where you create a new item in the popup menu:
createItem(null, "New Item",'n','Ü', null,null,null,null, "C:\\TEST.DXL")
Regards, Mathias
|
|